<?php
/**
 * +----------------------------------------------------------------------
 * | Author: 罗极
 * +----------------------------------------------------------------------
 * | Description: EventUnit.php
 * +----------------------------------------------------------------------
 * | User: Administrator Date: 8/20/ 0020 Time: 18:24
 * +----------------------------------------------------------------------
 */
namespace Framework\Event;

class EventUnit
{
    protected  $eventName;
    protected  $obj;
    protected  $callback;


    public function __construct(string $eventName, $obj, \Closure $callback)
    {
        $this->eventName = $eventName;
        $this->obj       = $obj;
        $this->callback  = $callback;
    }


    public function getEventName() : string
    {
        return $this->eventName;
    }

    public function setEventName($eventName)
    {
        $this->eventName = $eventName;
    }


    public function getObj()
    {
        return $this->obj;
    }

    public function setObj($obj)
    {
        $this->obj = $obj;
    }


    public function getCallback() : \Closure
    {
        return $this->callback;
    }

    public function setCallback($callback)
    {
        $this->callback = $callback;
    }

    public function call()
    {
        $this->callback->call($this->obj);
    }


}